package com.scau402.common.enums.outbound;

public enum OutboundType {
    // 出库类型编码、描述、对应Jade状态编码 对应JadeConstants枚举
    SALE("0", "销售出库", "3"),
    BORROW("1", "借货出库", "2"),
    RETURN("2", "还货出库", "4"),
    PROCESS("3", "加工出库", "5");

    private final String code;
    private final String description;
    private final String jadeStatusCode;

    OutboundType(String code, String description, String jadeStatusCode) {
        this.code = code;
        this.description = description;
        this.jadeStatusCode = jadeStatusCode;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public String getJadeStatusCode() {
        return jadeStatusCode;
    }

    // 根据 code 获取对应的枚举值
    public static OutboundType getByCode(String code) {
        for (OutboundType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid OutboundType code: " + code);
    }
}
